import React, { useEffect } from "react";

export default function Child() {
  useEffect(() => {
    console.log("订阅");
    // 相当于 componentWillUnmount
    return () => {
      console.log("取消订阅");
    };
  });
  return <div>Child</div>;
}
